import java.util.*;
public class Sort {
    public static void main(String[] args) {
        List<Student> list = new LinkedList<Student>();
        list.add(new Student("20175318", "小明", 'M', 18, 83, 85, 90));
        list.add(new Student("20175320", "太子", 'F', 40, 95, 73, 99));
        list.add(new Student("20175319", "江野", 'M', 20, 90, 75, 80.5));
        list.add(new Student("20175321", "阿旺", 'F', 19,79, 64, 79));
        list.add(new Student("20175317", "九九", 'M',21, 89, 92, 76));
        Iterator<Student> iterator = list.iterator();
        System.out.println("排序前：");
        while (iterator.hasNext()) {
            Student stu = iterator.next();
            System.out.println(stu.toString());
        }
        Collections.sort(list, new ComparatorByMark());
        System.out.println("按照总分排序后：");
        iterator = list.iterator();
        while (iterator.hasNext()) {
            Student stu = iterator.next();
            System.out.println(stu.toString());
        }
        Collections.sort(list, new ComparatorByID());
        System.out.println("按照学号排序后：");
        iterator = list.iterator();
        while (iterator.hasNext()) {
            Student stu = iterator.next();
            System.out.println(stu.toString());
        }
    }
}